package com.some;

import java.util.Scanner;
import java.util.concurrent.ThreadPoolExecutor;

public class BWillWin_test {
    public void BWillWin() {
        Scanner sc = new Scanner(System.in);
        int count = 21;
        int A = 1, B = 0;
        count -= A;
        System.out.println("A先取1个石头");
        System.out.println("还剩" + count + "个石头");
        while (count > 0) {
            // B取
            B = (5-A);
            count -= B;
            System.out.println("B取" + B + "个石头");
            System.out.println("还剩" + count + "个石头");
            if (count==1){
                System.out.println("B玩家已取完石头，此时石头还剩下1块，B玩家胜利！");
                break;
            }
            // A取
            System.out.println("A玩家输入想拿的石头数：");
            A = sc.nextInt();
            count -= A;
            System.out.println("A取" + A + "个石头");
            System.out.println("还剩" + count + "个石头");
        }
    }

    public static void main(String[] args) {
        BWillWin_test bWillWin_test = new BWillWin_test();
        bWillWin_test.BWillWin();
    }
}
